home *** CD-ROM | disk | FTP | other *** search
Wrap
/* File: PictUtils.h Contains: Picture Utilities Interfaces. Version: Technology: System 7.5 Release: Universal Interfaces 3.0d3 on Copland DR1 Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved. Bugs?: If you find a problem with this file, send the file and version information (from above) and the problem description to: Internet: apple.bugs@applelink.apple.com AppleLink: APPLE.BUGS */ #ifndef __PICTUTILS__ #define __PICTUTILS__ #ifndef __TYPES__ #include <Types.h> #endif #ifndef __WINDOWS__ #include <Windows.h> #endif #ifndef __PALETTES__ #include <Palettes.h> #endif #ifdef __cplusplus extern "C" { #endif #if PRAGMA_IMPORT_SUPPORTED #pragma import on #endif #if PRAGMA_ALIGN_SUPPORTED #pragma options align=mac68k #endif #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE /* verbs for the GetPictInfo, GetPixMapInfo, and NewPictInfo calls */ enum { returnColorTable = 0x0001, returnPalette = 0x0002, recordComments = 0x0004, recordFontInfo = 0x0008, suppressBlackAndWhite = 0x0010 }; enum { /* color pick methods */ systemMethod = 0, /* system color pick method */ popularMethod = 1, /* method that chooses the most popular set of colors */ medianMethod = 2, /* method that chooses a good average mix of colors */ /* color bank types */ ColorBankIsCustom = -1, ColorBankIsExactAnd555 = 0, ColorBankIs555 = 1 }; typedef long PictInfoID; struct CommentSpec { short count; /* number of occurrances of this comment ID */ short ID; /* ID for the comment in the picture */ }; typedef struct CommentSpec CommentSpec; typedef CommentSpec *CommentSpecPtr; typedef CommentSpecPtr *CommentSpecHandle; struct FontSpec { short pictFontID; /* ID of the font in the picture */ short sysFontID; /* ID of the same font in the current system file */ long size[4]; /* bit array of all the sizes found (1..127) (bit 0 means > 127) */ short style; /* combined style of all occurrances of the font */ long nameOffset; /* offset into the fontNamesHdl handle for the font’s name */ }; typedef struct FontSpec FontSpec; typedef FontSpec *FontSpecPtr; typedef FontSpecPtr *FontSpecHandle; struct PictInfo { short version; /* this is always zero, for now */ long uniqueColors; /* the number of actual colors in the picture(s)/pixmap(s) */ PaletteHandle thePalette; /* handle to the palette information */ CTabHandle theColorTable; /* handle to the color table */ Fixed hRes; /* maximum horizontal resolution for all the pixmaps */ Fixed vRes; /* maximum vertical resolution for all the pixmaps */ short depth; /* maximum depth for all the pixmaps (in the picture) */ Rect sourceRect; /* the picture frame rectangle (this contains the entire picture) */ long textCount; /* total number of text strings in the picture */ long lineCount; /* total number of lines in the picture */ long rectCount; /* total number of rectangles in the picture */ long rRectCount; /* total number of round rectangles in the picture */ long ovalCount; /* total number of ovals in the picture */ long arcCount; /* total number of arcs in the picture */ long polyCount; /* total number of polygons in the picture */ long regionCount; /* total number of regions in the picture */ long bitMapCount; /* total number of bitmaps in the picture */ long pixMapCount; /* total number of pixmaps in the picture */ long commentCount; /* total number of comments in the picture */ long uniqueComments; /* the number of unique comments in the picture */ CommentSpecHandle commentHandle; /* handle to all the comment information */ long uniqueFonts; /* the number of unique fonts in the picture */ FontSpecHandle fontHandle; /* handle to the FontSpec information */ Handle fontNamesHandle; /* handle to the font names */ long reserved1; long reserved2; }; typedef struct PictInfo PictInfo; typedef PictInfo *PictInfoPtr; typedef PictInfoPtr *PictInfoHandle; typedef pascal OSErr (*InitPickMethodProcPtr)(SInt16 colorsRequested, UInt32 *dataRef, SInt16 *colorBankType); #if GENERATINGCFM typedef UniversalProcPtr InitPickMethodUPP; #else typedef InitPickMethodProcPtr InitPickMethodUPP; #endif enum { uppInitPickMethodProcInfo = kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(SInt16))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(UInt32 *))) | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(SInt16 *))) }; #if GENERATINGCFM #define NewInitPickMethodProc(userRoutine) \ (InitPickMethodUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppInitPickMethodProcInfo, GetCurrentArchitecture()) #else #define NewInitPickMethodProc(userRoutine) \ ((InitPickMethodUPP) (userRoutine)) #endif #if GENERATINGCFM #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, colorBankType) \ CallUniversalProc((UniversalProcPtr)(userRoutine), uppInitPickMethodProcInfo, (colorsRequested), (dataRef), (colorBankType)) #else #define CallInitPickMethodProc(userRoutine, colorsRequested, dataRef, colorBankType) \ (*(userRoutine))((colorsRequested), (dataRef), (colorBankType)) #endif typedef pascal OSErr (*RecordColorsProcPtr)(UInt32 dataRef, RGBColor *colorsArray, SInt32 colorCount, SInt32 *uniqueColors); #if GENERATINGCFM typedef UniversalProcPtr RecordColorsUPP; #else typedef RecordColorsProcPtr RecordColorsUPP; #endif enum { uppRecordColorsProcInfo = kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(RGBColor *))) | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(SInt32))) | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(SInt32 *))) }; #if GENERATINGCFM #define NewRecordColorsProc(userRoutine) \ (RecordColorsUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppRecordColorsProcInfo, GetCurrentArchitecture()) #else #define NewRecordColorsProc(userRoutine) \ ((RecordColorsUPP) (userRoutine)) #endif #if GENERATINGCFM #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, uniqueColors) \ CallUniversalProc((UniversalProcPtr)(userRoutine), uppRecordColorsProcInfo, (dataRef), (colorsArray), (colorCount), (uniqueColors)) #else #define CallRecordColorsProc(userRoutine, dataRef, colorsArray, colorCount, uniqueColors) \ (*(userRoutine))((dataRef), (colorsArray), (colorCount), (uniqueColors)) #endif typedef pascal OSErr (*CalcColorTableProcPtr)(UInt32 dataRef, SInt16 colorsRequested, void *colorBankPtr, CSpecArray resultPtr); #if GENERATINGCFM typedef UniversalProcPtr CalcColorTableUPP; #else typedef CalcColorTableProcPtr CalcColorTableUPP; #endif enum { uppCalcColorTableProcInfo = kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32))) | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(SInt16))) | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(CSpecArray*))) }; #if GENERATINGCFM #define NewCalcColorTableProc(userRoutine) \ (CalcColorTableUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppCalcColorTableProcInfo, GetCurrentArchitecture()) #else #define NewCalcColorTableProc(userRoutine) \ ((CalcColorTableUPP) (userRoutine)) #endif #if GENERATINGCFM #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, colorBankPtr, resultPtr) \ CallUniversalProc((UniversalProcPtr)(userRoutine), uppCalcColorTableProcInfo, (dataRef), (colorsRequested), (colorBankPtr), (resultPtr)) #else #define CallCalcColorTableProc(userRoutine, dataRef, colorsRequested, colorBankPtr, resultPtr) \ (*(userRoutine))((dataRef), (colorsRequested), (colorBankPtr), (resultPtr)) #endif typedef pascal OSErr (*DisposeColorPickMethodProcPtr)(UInt32 dataRef); #if GENERATINGCFM typedef UniversalProcPtr DisposeColorPickMethodUPP; #else typedef DisposeColorPickMethodProcPtr DisposeColorPickMethodUPP; #endif enum { uppDisposeColorPickMethodProcInfo = kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UInt32))) }; #if GENERATINGCFM #define NewDisposeColorPickMethodProc(userRoutine) \ (DisposeColorPickMethodUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, GetCurrentArchitecture()) #else #define NewDisposeColorPickMethodProc(userRoutine) \ ((DisposeColorPickMethodUPP) (userRoutine)) #endif #if GENERATINGCFM #define CallDisposeColorPickMethodProc(userRoutine, dataRef) \ CallUniversalProc((UniversalProcPtr)(userRoutine), uppDisposeColorPickMethodProcInfo, (dataRef)) #else #define CallDisposeColorPickMethodProc(userRoutine, dataRef) \ (*(userRoutine))((dataRef)) #endif extern pascal OSErr GetPictInfo(PicHandle thePictHandle, PictInfo *thePictInfo, short verb, short colorsRequested, short colorPickMethod, short version) THREEWORDINLINE(0x303C, 0x0800, 0xA831); extern pascal OSErr GetPixMapInfo(PixMapHandle thePixMapHandle, PictInfo *thePictInfo, short verb, short colorsRequested, short colorPickMethod, short version) THREEWORDINLINE(0x303C, 0x0801, 0xA831); extern pascal OSErr NewPictInfo(PictInfoID *thePictInfoID, short verb, short colorsRequested, short colorPickMethod, short version) THREEWORDINLINE(0x303C, 0x0602, 0xA831); extern pascal OSErr RecordPictInfo(PictInfoID thePictInfoID, PicHandle thePictHandle) THREEWORDINLINE(0x303C, 0x0403, 0xA831); extern pascal OSErr RecordPixMapInfo(PictInfoID thePictInfoID, PixMapHandle thePixMapHandle) THREEWORDINLINE(0x303C, 0x0404, 0xA831); extern pascal OSErr RetrievePictInfo(PictInfoID thePictInfoID, PictInfo *thePictInfo, short colorsRequested) THREEWORDINLINE(0x303C, 0x0505, 0xA831); extern pascal OSErr DisposePictInfo(PictInfoID thePictInfoID) THREEWORDINLINE(0x303C, 0x0206, 0xA831); #if OLDROUTINENAMES #define DisposPictInfo(thePictInfoID) DisposePictInfo(thePictInfoID) #endif #endif #if PRAGMA_ALIGN_SUPPORTED #pragma options align=reset #endif #if PRAGMA_IMPORT_SUPPORTED #pragma import off #endif #ifdef __cplusplus } #endif #endif /* __PICTUTILS__ */